// ==UserScript==
// @name         新商盟工具
// @namespace    http://tampermonkey.net/
// @version      2.3
// @description  自己使用的脚本，不允许外部使用！
// @author       You
// @match        <$URL$>
// @grant             unsafeWindow
// @grant             GM_xmlhttpRequest
// @grant             GM_setClipboard
// @grant             GM_setValue
// @grant             GM_getValue
// @grant             GM_openInTab
// @grant             GM_info
// @grant             GM_registerMenuCommand
// @grant             GM_cookie
// @include      *://*.xinshangmeng.com/*
// ==/UserScript==

function injectionJs(url) {
  var js = document.createElement('script');
  js.type = "text/javascript";
  js.src = url;
  document.head.appendChild(js)
}

function injectionCss(url) {
  var css = document.createElement('link');
  css.rel = 'stylesheet';
  css.href = url;
  document.head.appendChild(css);
}
injectionCss('https://cdn.staticfile.org/element-plus/1.0.2-beta.65/theme-chalk/index.min.css');
injectionCss('http://xsm.yan9.net:50080/css/command.min.css');
injectionCss('http://xsm.yan9.net:50080/css/access.min.css');
injectionJs('http://xsm.yan9.net:50080/js/apis.js')
injectionJs('https://cdn.staticfile.org/moment.js/2.29.1/moment.min.js');
injectionJs('https://cdn.staticfile.org/vue/3.1.5/vue.global.prod.min.js');
var mainTimer = setInterval(function () {
  if (typeof Vue == 'undefined') return;
  clearInterval(mainTimer);
  injectionJs('https://cdn.staticfile.org/element-plus/1.0.2-beta.65/index.full.min.js')
  injectionJs('http://xsm.yan9.net:50080/js/command.js')
  injectionJs('http://xsm.yan9.net:50080/js/xinshangmeng.js')
  var mainTimer1 = setInterval(function () {
  if (typeof XinShangMengUtils == 'undefined') return;
      clearInterval(mainTimer1);
      XinShangMengUtils(GM_setValue,GM_getValue);
  },50);
},50);
